﻿@{
    ViewData["Title"] = "Home Page";
}

@await Component.InvokeAsync("Tab", ViewBag.Tabs)


<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>

    <a class="copy-talent-code" href="javascript:copyTalentCode('1', 'a')">复制</a>
</div>

<script>
    //保存达人码到剪贴板
    function copyTalentCode(date, code) {
        var clipboard = new ClipboardJS('.copy-talent-code', {
            text: function () {
                var url = window.location.href;
                return '达人码是：                 ' + code + '                       有效期至：                 ' + date;
            }
        });
    }

    function getADom() {
        return $('.copy-talent-code')[0];
    }

    window.onload = function (e, d) {
        this.localStorage.setItem('onload', new Date().getTime())
        return false;
    }
    window.onunload = function (e, d) {
        this.localStorage.setItem('onunload', new Date().getTime())
        this.localStorage.setItem('onunload ADom', getADom())
        return false;
    }
    window.onloadeddata = function (e, d) {
        this.localStorage.setItem('onloadeddata', new Date().getTime())
        return false;
    }
    window.onloadstart = function (e, d) {
        this.localStorage.setItem('onloadstart', new Date().getTime())
        return false;
    }

    window.onbeforeunload = function (e, d) {
        this.localStorage.setItem('onbeforeunload', new Date().getTime())
        this.localStorage.setItem('onbeforeunload ADom', getADom())
        //return false;
    }
  
    window.BeforeUnloadEvent = function () {
        this.localStorage.setItem('BeforeUnloadEvent', new Date().getTime())
        return false;
    }
</script>